<!DOCTYPE html>
<html lang="zxx">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
    <link rel="icon" href="images/favicon.png">
    <title></title>

    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" href="../css/materialize.css">
    <link rel="stylesheet" href="../css/loaders.css">
    <link rel="stylesheet" href="../css/lightbox.css">
    <link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">
    <link rel="stylesheet" href="../css/owl.carousel.min.css">
    <link rel="stylesheet" href="../css/owl.theme.default.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../css/layer.css">

</head>
<style>
    .segments-page {
        padding: 68px 20px 25px;
    }

    .input-radio {
        margin: 0 0 10px 0;
        display: inline-block;
    }
#drop_area{
	width: 303px !important;
}
</style>
<body>

<!-- navbar -->
<div class="navbar">
    <div class="container">
        <div class="row">
            <div class="col s9">
                <div class="content-left" onclick="javascript:history.back(-1);">
                    <i class="fa fa-chevron-left center"></i>
                </div>
            </div>

        </div>
    </div>

</div>
<!-- end navbar -->

<!-- sidebar -->

<!-- end sidebar -->

<!-- list -->
<div class="segments-page">

    <div class="container">
        <div class="pages-title">
            <h3>支付订单</h3>
            <div class="line"></div>
        </div>
        <div class="total-pay">
            <div class="row">
                <div class="col s8">
                    <div class="contents">
                        <p>订单额度</p>
                    </div>
                </div>
                <div class="col s4">
                    <div class="contents right">
                        <p id="Hangmoney"></p>
                    </div>
                </div>
                <div class="col s8">
                    <div class="contents">
                        <p>订单单价</p>
                    </div>
                </div>
                <div class="col s4">
                    <div class="contents right">
                        <p id="unit_price"></p>
                    </div>
                </div>
                <div class="col s8">
                    <div class="contents">
                        <p>手续费</p>
                    </div>
                </div>
                <div class="col s4">
                    <div class="contents right">
                        <p id="sxf"></p>
                    </div>
                </div>
                <div class="col s8">
                    <div class="contents">
                        <p>下单时间</p>
                    </div>
                </div>
                <div class="col s4">
                    <div class="contents right">
                        <p id="time" style="width: 120px;"></p>
                    </div>
                </div>
				<div class="col s8">
				    <div class="contents">
				        <p></p>
				    </div>
				</div>
				<div class="col s4">
				    <div class="contents right">
				        <p id="time" style="width: 120px;"></p>
				    </div>
				</div>
                <div class="col s8">
                    <div class="contents">
                        <h5>总价</h5>
                    </div>
                </div>
                <div class="col s4">
                    <div class="contents right">
                        <h5 id="total"></h5>
                    </div>
                </div>

            </div>
        </div>
        <div class="checkout">
            <form id="form" onsubmit="return false" action="#" method="post">
				<input type="hidden" name="patternId" id="patternId" value="" >
				<input type="hidden" name="OrderId" id="OrderId" value="" >
					 <p>买家付款信息:</p>
				 <input type="text" name="pattern" id="pattern" value="" placeholder="支付方式" disabled>
                <div id="bank" >
                    <input type="text" id="account_name"  disabled>
                    <input type="text"id="Card"  disabled>
                    <input type="text" id="Bank_deposit"  disabled>
					 <p>卖家付款信息:</p>
					 <input type="text"  id="sell_name"  placeholder="卖家银行卡姓名" disabled>
						 <input type="text" id="sell_Card"  placeholder="卖家银行卡号"  disabled>
						 <input type="text"   id="sell_Bank_deposit"placeholder="卖家银行开户行"  disabled>
                </div>
                <div id="alipay" >
					 <input type="text" id="payment_account" placeholder="买家付款账号" disabled>
					 <p>卖家付款信息:</p>
                    <input type="text" id="alipayaccount"  placeholder=""  disabled>
						 <p>请扫码二维码付款:</p>
				<img src="" id="alipay_pic"/>
                     
                </div>
				<p>请上传付款截图:</p>
				<div id="drop_area"><input type="hidden" name="file" value=""  id="file" ></div>
                <textarea class="no-mb" cols="30" id="textarea" rows="10" disabled></textarea>
				      <input type="password" name="password" id="password" placeholder="交易密码">
				<input id="consent" type="checkbox" name="consent"  value="1"/>
				<label for="consent">是否同意</label>
            </form>
        </div>

        <button class="button button-full z-depth-1" onclick="confirm_payment();"><i class="fa fa-send"></i>确认支付
        </button>
    </div>


</div>
<!-- end list -->

<script src="../js/jquery.min.js"></script>
<script src="../js/materialize.js"></script>
<script src="../js/numscroller.js"></script>
<script src="../js/lightbox.js"></script>
<script src="../js/owl.carousel.min.js"></script>
<script src="../js/main.js"></script>
<script src="../js/layer.js"></script>
<script src="../js/jquerysession.js"></script>
<script src="http://www.gongjuji.net/Content/files/jquery.md5.js"></script>
<script src="../js/index.js"></script>
<script src="../js/uploading.js"></script>
<script src="../js/mobileSelect.js"></script>
<script>
    $(document).ready(function () {
        var sellLIsturl = 'Order/Paylist';
        var sellLIstInfo = api_request(sellLIsturl, 'GET');
		
        if (sellLIstInfo.code == 1) {
            var data = sellLIstInfo.data;
			
            if (data !== '') {
                var Hangmoney = document.getElementById("Hangmoney");
                Hangmoney.innerHTML += data.Hangmoney + '￥';
                var unit_price = document.getElementById("unit_price");
                unit_price.innerHTML += data.unit_price + '￥';
                var sxf = document.getElementById("sxf");
                sxf.innerHTML += data.sxf + '￥';
                var total = document.getElementById("total");
                total.innerHTML += data.total + '￥';
                var time = document.getElementById("time");
                time.innerHTML += data.order_time;
					    $("#OrderId").val(data.id);
				  $("#user_id").val(data.user_id);
				    $("#sid").val(data.sid);
				var specialurl = 'cms/label/name/special';
				var specialInfo = api_request(specialurl, 'GET');
				if(specialInfo.data){
					$("#textarea").val(specialInfo.data);
				}
				var type=data.pattern == 0 ?'支付类型：银行卡支付':'支付类型：支付宝扫码支付';
				$('#pattern').attr('placeholder',type);
					$("#patternId").val(data.pattern);
				if(data.pattern==0){
				$("#account_name").val(data.account_name);
				$("#Bank_deposit").val(data.Bank_deposit);
				$("#Card").val(data.Card);
				var Userbankurl = 'Order/UserbankList?bid='+data.bid;
				var UserbankurlInfo = api_request(Userbankurl, 'GET');
				$("#sell_name").val(UserbankurlInfo.data.account_name);
				$("#sell_Card").val(UserbankurlInfo.data.Card);
				$("#sell_Bank_deposit").val(UserbankurlInfo.data.Bank_deposit);
		
				 $("#bank").show(); //显示银行卡
				$("#alipay").hide(); //隐藏支付宝 
				}else{
					
						$('#payment_account').attr('placeholder','买家付款账号：'+data.alipay);
				$('#alipayaccount').attr('placeholder','卖家收款账号：'+data.shroff_number);
				$('#alipay_pic').attr('src',data.alipay_pic);
				$("#alipay").show(); //显示支付宝
				$("#bank").hide(); //隐藏银行卡 
				}
            }

        }
    });

    function confirm_payment() {
        var params = $('#form').serializeObject();
	
		if(!params.patternId){
			layer.open({
			    content: '请选择付款方式'
			    , skin: 'msg'
			    , time: 2 //2秒后自动关闭
			});
			return false;
		}
	if(params.patternId==1){
	
		// if(!params.file){
		// 	layer.open({
		// 	    content: '请上传付款截图'
		// 	    , skin: 'msg'
		// 	    , time: 2 //2秒后自动关闭
		// 	});
		// 	return false;
		// }
	}

		if(!params.password){
			layer.open({
			    content: '请输入交易密码！'
			    , skin: 'msg'
			    , time: 2 //2秒后自动关闭
			});
			return false;
		}
	
		if(!params.consent){
			layer.open({
			    content: '请仔细查看说明,并且同意！'
			    , skin: 'msg'
			    , time: 3 //2秒后自动关闭
			});
			return false;
		}

		var modOrderurl = 'Order/pay';
		var modOrderInfo = api_request(modOrderurl, 'POST',params);
	
	if (modOrderInfo.code == 2) {
	    layer.open({
	        content: modOrderInfo.data
	        , skin: 'msg'
	        , time: 1//2秒后自动关闭
	        , end: function () {
	            location.href = modOrderInfo.tourl;
	        }
	    });
	}
    }
  var dragImgUpload = new DragImgUpload("#drop_area",{
	         callback:function (files) {
					 data={
						 upload:files[0]
					 }
			   var uploadUrl = 'Buy/upload';
			    
			   var uploadinfo = api_request(uploadUrl, 'POST',data,'1')
		
		if(uploadinfo.code==1){
			 $('#file').attr('value',uploadinfo.data)
			layer.open({
			    content: '上传成功！'
			    , skin: 'msg'
			    , time: 2//2秒后自动关闭
			   
			});
		}
			
	         }
	     })
</script>
</body>
</html>